#include <mockcpp/mockcpp.hpp>
#include <testngpp/testngpp.hpp>
#include <Length.h>

USING_MOCKCPP_NS
USING_TESTNGPP_NS

FIXTURE(Length)
{
    //Length length
    TEST(should be able to judge the length1 is equal to length2: length1 = 1 mile, length2 = 1760 yard)
    {
        Length length1(1, MILE);
        Length length2(1760, YARD);
        ASSERT_TRUE(length1 == length2);
    }
    
    TEST(should be able to judge length1 = length2: length1 = 1 yard, length2 = 3 feet)
    {
        Length length1(1, YARD);
        Length length2(3, FEET);
        ASSERT_TRUE(length1 == length2);
    }

    TEST(should be able to judge length1 = length2: length1 = 1 mile, length2 = 5280 feet)
    {
        Length length1(1, MILE);
        Length length2(5280, FEET);
        ASSERT_TRUE(length1 == length2);
    }
    
    TEST(should be able to judge length1 = length2: length1 = 1 feet, length2 = 12 inch)
    {
        Length length1(1, FEET);
        Length length2(12, INCH);
        ASSERT_TRUE(length1 == length2);
    }
    
    TEST(should be able to judge length3(3 feet) == length1(12 inch) + length2(2 feet))
    {
        Length length1(12, INCH);
        Length length2(2, FEET);
        Length length3(3, FEET);
        ASSERT_EQ(length3, length1 + length2);
    }
    
    TEST(should be able to judge 35 INCH equals to 2 FEET 11 INCH)
    {
        Length length(35, INCH);
        char str[100];
        length.formatInWhole(str);
        ASSERT_TRUE(strcmp(str, "2 FEET 11 INCH") == 0);
    }
    
    TEST(should be able to judge 38 INCH equals to 1 YARD 2 INCH)
    {
        Length length(38, INCH);
        char str[100];
        length.formatInWhole(str);
        ASSERT_TRUE(strcmp(str, "1 YARD 2 INCH") == 0);
    }
    
    TEST(should be able to judge 48 INCH equals to 1 YARD 1 FEET)
    {
        Length length(48, INCH);
        char str[100];
        length.formatInWhole(str);
        ASSERT_TRUE(strcmp(str, "1 YARD 1 FEET") == 0);
    }
    
    TEST(should be able to judge 5 FEET equals to 1 YARD 2 FEET)
    {
        Length length(5, FEET);
        char str[100];
        length.formatInWhole(str);
        ASSERT_TRUE(strcmp(str, "1 YARD 2 FEET") == 0);
    }
    
    TEST(should be able to judge 1781 YARD equals to 1 MILE 1 YARD)
    {
        Length length(1781, YARD);
        char str[100];
        length.formatInWhole(str);
        ASSERT_TRUE(strcmp(str, "1 MILE 21 YARD") == 0);
    }
    
    TEST(should be able to judge 2 INCH equals to 2 INCH)
    {
        Length length(2, INCH);
        char str[100];
        length.formatInInch(str);
        ASSERT_TRUE(strcmp(str, "2 INCH") == 0);
    }
    
    TEST(should be able to judge 2 FEET equals to 24 INCH)
    {
        Length length(2, FEET);
        char str[100];
        length.formatInInch(str);
        ASSERT_TRUE(strcmp(str, "24 INCH") == 0);
    }
    
    TEST(should be able to judge 3 YARD equals to 108 INCH)
    {
        Length length(3, YARD);
        char str[100];
        length.formatInInch(str);
        ASSERT_TRUE(strcmp(str, "108 INCH") == 0);
    }
    
    TEST(should be able to judge 2 MILE equals to 126720 INCH)
    {
        Length length(2, MILE);
        char str[100];
        length.formatInInch(str);
        ASSERT_TRUE(strcmp(str, "126720 INCH") == 0);
    }
};
